home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9826 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  67 lines

  1. Path: susx.ac.uk!taux5
  2. From: taux5@central.susx.ac.uk (Doan Nguyen)
  3. Newsgroups: comp.lang.c
  4. Subject: Invalid Indirection???
  5. Date: 13 Mar 1996 20:49:24 GMT
  6. Organization: University of Sussex
  7. Message-ID: <4i7cck$t67@infa.central.susx.ac.uk>
  8. NNTP-Posting-Host: solx1.central.susx.ac.uk
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I'm pretty new to C programming but I do know Modula-2 quite well and I
  12. was wondering if there was anyone out there who could tell me what
  13. the error "Invalid Indirection" means in C??
  14.  
  15. I'm writing a program to map some Fourier data into it's r and theta
  16. components. I'm converting this function from it's Fortran equivalent
  17. and that's why I'm using arrays.
  18.  
  19.  
  20. void Map_RTheta ( float *data )
  21. {
  22.  
  23. float tempa, tempb, tempi, tempj [NPIC-1];
  24. float xmap, ymap, rmap, Tmap [NPIC-1];
  25. float r, xi, yi, val, tmp;
  26. float pi, theta;
  27. int i, j;
  28. float *tempi_p;
  29. float *tempj_p;
  30. boolean test;
  31.  
  32. tempi_p = &tempi;
  33. tempj_p = &tempj;
  34. pi = 3.14159265359;
  35.  
  36.     for (i=0;i<=NPIC-1; i+=2) {          /* Copies Fourier Data into  */
  37.        *(data + i) = *(tempi_p + i);     /* tempi and tempj array     */
  38.     }
  39.  
  40.     for (j=1; j<=NPIC-1; j+=2) {
  41.        *(data + j) = *(tempj_p +(j-1));
  42.     }
  43.  
  44.     for (j=0;j<=NPIC-1; j+=2) {
  45.     theta = pi*(int)j / (NPIC-1);
  46.         for (i=0;i<=NPIC-1; i++) {
  47.            r = (int)i / sqrt(2.0);
  48.            xi = r*sin(theta);
  49.            yi = -(r)*cos(theta);
  50.            val = xi+NHP;
  51.            tmp = (tempi[i]*tempj[i])+(tempi[i+1]*tempj[i+1]));
  52.     
  53. /* This is where the compiler stops and says there's an invalid
  54. indirection for the "tmp" assignment */
  55.  
  56.         }
  57.     }
  58.         
  59. }
  60.  
  61.  
  62. Any help for where I'm going wrong would be much appreciated.
  63. NPIC and NHP are constants defined in another section of the program.
  64.  
  65.  
  66.  
  67.